Repository navigation
fix(docker-outside-of-docker): check DOCKER_GID on container start - #1749
Open
Vladimir (varmiral) wants to merge 5 commits into
Open
Vladimir (varmiral) wants to merge 5 commits into
Vladimir (varmiral) wants to merge 5 commits into
Conversation
…r the container restarts if the Docker GID has been changed
The DOCKER_GID variable must be defined every time the container starts; otherwise, after the Docker GID is changed via `sudoIf groupmod --gid "\${SOCKET_GID}" docker`, the socat fallback will trigger on subsequent restarts.
Kaniska (v-Kaniska244)
requested changes
Oct 12, 2026
Kaniska (v-Kaniska244)
left a comment
Contributor
There was a problem hiding this comment.
Thank you for the contribution. Would you please look into the failed tests. Also a version bump would be required for the feature.
Author
|
@microsoft-github-policy-service agree |
Author
|
Kaniska (@v-Kaniska244) please forgive my inattention. |
Kaniska (v-Kaniska244)
requested changes
Oct 27, 2026
Kaniska (v-Kaniska244)
left a comment
Contributor
There was a problem hiding this comment.
LGTM. One last request if possible, could you please add some details in the PR description and modify the subject as it's currently truncated. That way this change will be better documented.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DOCKER_GIDwas computed once ininstall.shat feature install time and baked into the generated/usr/local/share/docker-init.shthrough heredoc expansion. This causes several problems when the container starts:socatproxy. When the socket GID already matched the docker group GID, the conditionSOCKET_GID != DOCKER_GIDwas false and execution fell through to theelsebranch. That branch replaceddocker.sockwith asocatproxy even though nothing needed fixing.grep -E ".+:x:${SOCKET_GID}" /etc/groupis not anchored to the GID field:100also matches a group with GID1000Changes
DOCKER_GID="$(grep -oP ...)"frominstall.sh.docker-init.shnow reads the docker GID at container start:DOCKER_GID="$(getent group docker | cut -d: -f3)"SOCKET_GID == DOCKER_GID→ log it and do nothing (no proxy, no group changes)SOCKET_GID != 0and no group with that GID exists →groupmod --gid "${SOCKET_GID}" dockersocatproxy, as beforegrepon/etc/groupwithgetent group "${SOCKET_GID}". It does an exact lookup by GID and also works with NSS sources other than/etc/group.